﻿using UnityEngine;
using System.Collections;
using UniLua;

namespace TCG.FFI
{
	public static class UnityAudioClipLib 
	{
		public static string LIB_NAME = "UnityAudioClipLib";

		public static int mf_GetChannels (ILuaState luaState)
		{
			AudioClip clip = LuaTools.L_CheckUData (luaState, 1, LIB_NAME) as AudioClip;
			luaState.PushInteger (clip.channels);
			return 1;
		}

		public static int mf_GetFrequency (ILuaState luaState)
		{
			AudioClip clip = LuaTools.L_CheckUData (luaState, 1, LIB_NAME) as AudioClip;
			luaState.PushInteger (clip.frequency);
			return 1;
		}

		public static int mf_IsReadyToPlay (ILuaState luaState)
		{
			AudioClip clip = LuaTools.L_CheckUData (luaState, 1, LIB_NAME) as AudioClip;
			luaState.PushBoolean (clip.isReadyToPlay);
			return 1;
		}

		public static int mf_GetLength (ILuaState luaState)
		{
			AudioClip clip = LuaTools.L_CheckUData (luaState, 1, LIB_NAME) as AudioClip;
			luaState.PushNumber (clip.length);
			return 1;
		}

		public static int mf_GetSamples (ILuaState luaState)
		{
			AudioClip clip = LuaTools.L_CheckUData (luaState, 1, LIB_NAME) as AudioClip;
			luaState.PushInteger (clip.samples);
			return 1;
		}


	}
}	